package io.bear.common.exception;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 业务相关异常
 * <p>
 * 适用场景：
 * <p>
 * 1、由于未知原因造成的 业务无法正常执行时抛出异常
 */
@Data
public class BizException extends RuntimeException {
    @ApiModelProperty(value = "响应编码")
    protected Integer code = 500;

    public BizException() {
    }

    public BizException(String message) {
        super(message);
    }

    public BizException(String message, Throwable cause) {
        super(message, cause);
    }

    public BizException(Throwable cause) {
        super(cause);
    }

    public BizException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public BizException(Integer code) {
        this.code = code;
    }

    public BizException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public BizException(String message, Throwable cause, Integer code) {
        super(message, cause);
        this.code = code;
    }

    public BizException(Throwable cause, Integer code) {
        super(cause);
        this.code = code;
    }

    public BizException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Integer code) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
    }
}
